package org.testis.testdriver.validation;

import org.testis.testdriver.*;
import org.testis.testdriver.AtofEnumaration.AtofLogLevel;



/**
 * This class is used to make validation according to PostConditionCase 
 * Startegy.
 * 
 * @author barisergun
 */
public class TestPartValidatePostConditionCaseStrategy extends TestPartValidateStrategy
{

    public TestPartValidatePostConditionCaseStrategy(TestPart inUse)
    {
        super(inUse);
    }


    @Override
    protected boolean validateIfToContinue(boolean partResult)
    {
        if (testPartInRun.getIsCritical() == true && (partResult == false)) {
                NotificationSubjectSingleton.getInstance().notifyLogMessages(
                    testPartInRun.getPartName(),
                    AtofLogLevel.WARN,
                    "Test Suite Post Condition critically failed at " +
                    testPartInRun.getPartName(),
                    testPartInRun.getPartGuid());
                NotificationSubjectSingleton.getInstance().notifyLogMessages(
                    testPartInRun.getPartName(),
                    AtofLogLevel.INFO,
                    TestStringConstants.getEndedExecutionString(),
                    testPartInRun.getPartGuid());
                throw new CriticalPostCaseException(
                    "Critical Post Condition Failed");
            }
        return true;
    }


    
}